﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Algorithm.Interview_Easy_50_FirstUniqChar
{
    class MainProject
    {
        static void Main(string[] args)
        {
            //Console.WriteLine(TimeRequiredToBuy(new int[] { 84, 49, 5, 24, 70, 77, 87, 8 }, 3));
            Console.ReadKey();
        }
        public char FirstUniqChar(string s)
        {
            //队列(没必要)
            Dictionary<char, int> dic = new Dictionary<char, int>();

            foreach (var item in s)
            {
                if (dic.ContainsKey(item)) dic[item]++;
                else dic.Add(item, 1);
            }
                  
            foreach (var item in dic) if (item.Value == 1) return item.Key;
            return ' ';
        }

    }
}
